home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscSplitView.h
- //
- // Written by Dwight D. Everhart, based on SideSplitView by Mary McNabb
- // of NeXT (from the ZooView mini-example).
- //
- // Copyright (c) 1996 by Dwight D. Everhart. All rights reserved.
- // Version 1.11; February 7, 1996
- //
- // This notice may not be removed from this source code.
- //
- // This object is included in the MiscKit by permission from the author
- // and its use is governed by the MiscKit license, found in the file
- // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
- //
- // Although this code started as SideSplitView, there is little that remains
- // of the original code. Still, the author is grateful to Ms. McNabb for
- // providing a starting point for this code. This is the distribution notice
- // that she put in her code:
- //
- // You may freely copy, distribute, and reuse the code in this example.
- // NeXT disclaims any warranty of any kind, expressed or implied, as to its
- // fitness for any particular use.
- //
- // Purpose:
- // This class implements a view which divides its frame, either vertically
- // or horizontally, into two or more adjacent areas in which are displayed
- // its subviews. The user can change the proportion of the areas occupied
- // by the subviews relative to each other. The class can also save and
- // restore its subview divisions to a string or a default. The interface
- // is compatible with NXSplitView, and the divisions saving mechanism has
- // the same style of interface as Window's frame saving mechanism.
- //
- // Requires:
- // MiscAppDefaults category
- // Dimple.tiff image (embedded into Dimple.m by Don Yacktman)
- //
-
- #import <appkit/appkit.h>
-
- @interface MiscSplitView: View
-
- {
- id delegate;
- struct _msvFlags {
- #ifdef __BIG_ENDIAN__
- unsigned int horizontal:1;
- unsigned int needsRetiling:1;
- unsigned int _RESERVED:6;
- #else
- unsigned int _RESERVED:6;
- unsigned int needsRetiling:1;
- unsigned int horizontal:1;
- #endif
- } msvFlags;
- }
-
- /* Initializing a MiscSplitView */
- + initialize;
- - initFrame: (const NXRect *) frameRect;
-
- /* Assigning a delegate */
- - delegate;
- - setDelegate: anObject;
-
- /* Assigning orientation */
- - (BOOL) isHorizontal;
- - setHorizontal: (BOOL) makeHorizontal;
-
- /* Accessing the dividers */
- - setDividersFromString: (const char *) data;
- - saveDividersToString: (char *) string;
- - setDividersUsingName: (const char *) name;
- - saveDividersUsingName: (const char *) name;
- + removeDividersUsingName: (const char *) name;
- - (const char *) dividersAutosaveName;
- - setDividersAutosaveName: (const char *) name;
-
- /* Drawing the view */
- - (NXCoord) dividerSize;
- - (NXCoord) dividerHeight;
- - (NXCoord) dividerWidth;
- - drawSelf: (const NXRect *) rects : (int) rectCount;
- - drawDivider: (const NXRect *) aRect;
-
- /* Managing component views */
- - constrainDivider: (int) dividerIndex
- leftFrame: (const NXRect *) leftFrame
- rightFrame: (const NXRect *) rightFrame
- min: (NXCoord *) min max: (NXCoord *) max;
- - constrainFramesLeft: (NXRect *) leftFrame andRight: (NXRect *) rightFrame
- besideDivider: (int) dividerIndex;
- - adjustSubviews;
- - resizeSubviews: (const NXSize *) oldSize;
- - setAutoresizeSubviews: (BOOL) flag;
- - addSubview: aView;
- - addSubview: aView : (int) place relativeTo: otherView;
- - replaceSubview: oldView with: newView;
-
- /* Handling events */
- - (BOOL) acceptsFirstMouse;
- - mouseDown: (NXEvent *) theEvent;
-
- /* Archiving */
- - write: (NXTypedStream *) stream;
- - read: (NXTypedStream *) stream;
-
- @end
-
-
- @interface Object (MiscSplitViewDelegate)
-
- - splitView: sender resizeSubviews: (const NXSize *) oldSize;
- - splitView: sender getMinY: (NXCoord *) minY maxY: (NXCoord *) maxY
- ofSubviewAt: (int) offset;
- - splitView: sender getMinX: (NXCoord *) minX maxX: (NXCoord *) maxX
- ofSubviewAt: (int) offset;
- - splitViewDidResizeSubviews: sender;
-
- @end
-
-